@extends('admin.layout')
@section('title', $title)
@section('content')
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                商品分类管理
                <small>分类编辑</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> 主页</a></li>
                <li><a href="#">分类</a></li>
                <li class="active">编辑</li>
            </ol>
        </section>

        <!-- Main content -->
        <section class="content">
            <div class="row">
                <!-- left column -->
                <div class="col-md-12">
                    @if(session('info'))
                        <div class="alert alert-success alert-dismissable"
                             id="info">
                            {{ session('info') }}
                        </div>
                @endif
                <!-- general form elements -->
                    <div class="box box-primary">
                        <div class="box-header with-border">
                            <h3 class="box-title">分类编辑</h3>
                        </div><!-- /.box-header -->
                        <!-- form start -->
                        <form role="form" action="{{ url('/admin/plate/plateDoEdit') }}" method="POST"
                              enctype="multipart/form-data">
                            {{ csrf_field() }}
                            <div class="box-body">
                                <div class="form-group has-success">
                                    <label class="control-label" for="inputSuccess"><i
                                                class="fa fa-check"></i>所属分类</label>
                                    <select class="form-control" name="pid">
                                        <option value="0">根分区</option>
                                        @foreach($alldata as $k => $v)
                                            <option value="{{ $v->id }}"
                                                    @if($v->id == $data->id) disabled @endif
                                                    @if($v->id == $data->pid) selected @endif>
                                                {{ $v->platename }}
                                            </option>
                                        @endforeach
                                    </select>
                                </div>
                                <div class="form-group has-success">
                                    <label class="control-label" for="inputSuccess"><i
                                                class="fa fa-check"></i>分类名称</label>
                                    <input class="form-control" id="inputSuccess" placeholder="{{ $data->platename }}" type="text"
                                           name='platename'>
                                    <input type="hidden" value="{{ $data->id }}" name="id">
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputFile">添加logo</label>
                                    <input type="file" id="exampleInputFile" name="pic">
                                    <p class="help-block">选择该商品分类的Lolo</p>
                                </div>
                            </div><!-- /.box-body -->
                            <div class="box-footer">
                                <button type="submit" class="btn btn-primary">修改</button>
                            </div>
                        </form>
                    </div><!-- /.box -->
                </div><!--/.col (left) -->
            </div>   <!-- /.row -->
        </section><!-- /.content -->
    </div><!-- /.content-wrapper -->
    <script type="text/javascript">
        window.onload = function () {
            setInterval(function () {
                $('#info').slideUp(1000);
            }, 3000)
        }
    </script>
@endsection